package Tree;

public class 相同的树 {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if (p == null) return q == null;
        else if (q == null) return false;
        else if (p.val != q.val) return false;
        return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
    }
}
